<?php
require_once 'xml.class.php';
class UserXml extends xml{
	public function getUserByID($id){
		$user = array();
		foreach($this->xml->children() as $child){
			if($id==(string)$child->id){
				$user['id'] = $id;
				$user['name'] = (string)$child->name;
				$user['passwd'] = (string)$child->password;
				break;
			} 
		}
		return $user;
	}
	public function hasUser($name,$passwd){
		$user = array();
		foreach($this->xml->children() as $child){
			if($name==(string)$child->name&&$passwd==(string)$child->password){
				$user['id'] = (string)$child->id;
				$user['name'] = (string)$child->name;
				$user['passwd'] = (string)$child->password;
				break;
			}
		}
		return empty($user)?false:$user;
	}
}
?>
